using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class InvoiceDeposit: IEquatable<InvoiceDeposit>
	{

		#region Private Members

		private string _invoice_no; 
		private DateTime? _date_of_invoice; 
		private string _kind_of_invoice; 
		private double _money; 
		private string _currency; 
		private double _exchange; 
		private string _cashier; 
		private string _partner; 
		private string _payment_form; 
		private string _bank; 
		private string _remark; 		
		#endregion

		#region Constructor

		public InvoiceDeposit()
		{
			_invoice_no = String.Empty; 
			_date_of_invoice = new DateTime?(); 
			_kind_of_invoice = String.Empty; 
			_money = new double(); 
			_currency = String.Empty; 
			_exchange = new double(); 
			_cashier = String.Empty; 
			_partner = String.Empty; 
			_payment_form = String.Empty; 
			_bank = String.Empty; 
			_remark = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public InvoiceDeposit(
			string invoice_no)
			: this()
		{
			_invoice_no = invoice_no;
			_date_of_invoice = null;
			_kind_of_invoice = String.Empty;
			_money = 0;
			_currency = String.Empty;
			_exchange = 0;
			_cashier = String.Empty;
			_partner = String.Empty;
			_payment_form = String.Empty;
			_bank = String.Empty;
			_remark = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual string InvoiceNo
		{
			get
			{ 
				return _invoice_no;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for InvoiceNo", value, "null");
				
				if(  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for InvoiceNo", value, value.ToString());
				
				_invoice_no = value;
			}
		}
			
		public virtual DateTime? DateOfInvoice
		{
			get
			{ 
				return _date_of_invoice;
			}
			set
			{
				_date_of_invoice = value;
			}

		}
			
		public virtual string KindOfInvoice
		{
			get
			{ 
				return _kind_of_invoice;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for KindOfInvoice", value, value.ToString());
				
				_kind_of_invoice = value;
			}
		}
			
		public virtual double Money
		{
			get
			{ 
				return _money;
			}
			set
			{
				_money = value;
			}

		}
			
		public virtual string Currency
		{
			get
			{ 
				return _currency;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Currency", value, value.ToString());
				
				_currency = value;
			}
		}
			
		public virtual double Exchange
		{
			get
			{ 
				return _exchange;
			}
			set
			{
				_exchange = value;
			}

		}
			
		public virtual string Cashier
		{
			get
			{ 
				return _cashier;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Cashier", value, value.ToString());
				
				_cashier = value;
			}
		}
			
		public virtual string Partner
		{
			get
			{ 
				return _partner;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Partner", value, value.ToString());
				
				_partner = value;
			}
		}
			
		public virtual string PaymentForm
		{
			get
			{ 
				return _payment_form;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for PaymentForm", value, value.ToString());
				
				_payment_form = value;
			}
		}
			
		public virtual string Bank
		{
			get
			{ 
				return _bank;
			}

			set	
			{	
				if(  value != null &&  value.Length > 10)
					throw new ArgumentOutOfRangeException("Invalid value for Bank", value, value.ToString());
				
				_bank = value;
			}
		}
			
		public virtual string Remark
		{
			get
			{ 
				return _remark;
			}

			set	
			{	
				if(  value != null &&  value.Length > 200)
					throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_remark = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			InvoiceDeposit castObj = (InvoiceDeposit)obj; 
			return ( castObj != null ) &&
				( this._invoice_no == castObj.InvoiceNo );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _invoice_no.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(InvoiceDeposit other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._invoice_no == other.InvoiceNo );
				   
		}

		#endregion
		
	}
}
